from flask import Flask
from controller import lg,inx,tea,user
from model import redisclient
def create_app():
    RouterList=[lg,inx,tea,user]
    from model import db
    from flask_compress import Compress
    from config.config import conf
    app=Flask(__name__,template_folder=conf.templatespath,static_folder=conf.staticpath)
    app.config.from_object(conf)
    redisclient.init_app(app=app)
    db.init_app(app=app)
    Compress(app=app)
    app=registerBlue(app=app,Routerlist=RouterList)
    with app.app_context():
     
        db.create_all()
    return app
def registerBlue(app: object,Routerlist: list)-> object:
    for i in Routerlist:
        app.register_blueprint(i)
    return app